package com.franklin.java.api.state;


import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.project.Project;
import com.intellij.util.xmlb.XmlSerializerUtil;
import org.jetbrains.annotations.Nullable;

/**
 * @author Franklin
 * @since 2021/2/8 14:42
 */
public abstract class BasePersistentState<T extends BasePersistentState<T>> implements PersistentStateComponent<T> {

    public final static String PERSISTENT_PATH = "FranklinJavaDataHelper/";

    @Nullable
    @Override
    public T getState() {
        return (T)this;
    }

    @Override
    public void loadState(T t) {
        XmlSerializerUtil.copyBean(t,this);
    }

}
